"""Demonstrate tmpdir_factory."""
import json
import pytest


@pytest.fixture(scope='module')
def author_file_json(tmpdir_factory):
    """像一个数据文件中写入一些作者信息"""
    python_author_data = {
        'xiao zhou': {'City': 'su zhou'},
        'xiao fo': {'City': 'shen zhen'},
        'xiao yi': {'City': 'shen zhen'}
    }

    file = tmpdir_factory.mktemp('data').join('author_file.json')
    print('file:{}'.format(str(file)))

    with file.open('w') as f:
        json.dump(python_author_data, f)

    return file
